#ifndef CUSTOMITEMDELEGRATE_H
#define CUSTOMITEMDELEGRATE_H

#include <QWidget>
#include <QStyledItemDelegate>
#include <QLineEdit>
#include <QRegExp>

class CustomItemDelegrate : public QStyledItemDelegate
{
    Q_OBJECT
public:
    CustomItemDelegrate(const QRegExp& regExp, QObject* parent = nullptr);
    ~CustomItemDelegrate(void);

    QWidget *createEditor(QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
    void setEditorData(QWidget* editor, const QModelIndex& index ) const;
    void setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index ) const;

private:
    QRegExp m_regExp;
};

#endif // CUSTOMITEMDELEGRATE_H
